#include <iostream>
#include <string>

using namespace std;

void fun(string str)
{
    int len = str.length();
    char char_cur = str[0];
    int cnt = 1;
    for(int i = 1;i < len;++i)
    {
        if(str[i] == char_cur)
        {
            ++cnt;
        }
        if(str[i] != char_cur || i == len-1)
        {
            if(cnt >= 2)
            {
                for(int j = 0;j < cnt;++j) cout<<char_cur;
                cout<<endl;
            }
            char_cur = str[i];
            cnt = 1;
        }
    }
}

int main(){
    string strin;
    while(cin>>strin)
    {
        fun(strin);
    }
    return 0;
}